package com.scalar.chiptrack.operations.process.forms;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;

import com.scalar.chiptrack.operations.process.BomRevOrSchmFileDetails;
import com.scalar.chiptrack.operations.process.BomRevOrSchmFileList;

public class BoardKitForm extends ActionForm
{
    // added for Brecis - Balaram on Mar 20, 2003
    public static final String PRODUCT_TYPE_BOARD = "BOARD";
    public static final String PRODUCT_TYPE_KIT = "KIT";

    private BomRevOrSchmFileList bomRevFiles ;
    private BomRevOrSchmFileList schmaFiles;

    /** Creates a new instance of BoardMaking */
    public BoardKitForm ()
	{
            bomRevFiles = new BomRevOrSchmFileList();
            schmaFiles = new BomRevOrSchmFileList();
    }
    
    /** Instance Variables */
    
    private int productId = -1;
    private int processStepId = -1;
    private String partNumber = null;
    private String description = null;
    private String unitPrice = null;
    private String productType = null;
    private boolean isApproved = false;
    private ArrayList vendorLocations = null;
	private String pcbRevNo = null;//Bhaskar on 14 Feb 2004
	private String bomRevId = null;//Bhaskar on 18 Feb 2004
	private String schematicId = null;//Bhaskar on 18 Feb 2004
	private String bomRevNumber = null;//Bhaskar on 18 Feb 2004
	private String schematicNumber = null;//Bhaskar on 18 Feb 2004
	private FormFile bomRevNo = null;//Bhaskar on 14 Feb 2004 (try to change this to file obj)
	private FormFile schematic = null;//Bhaskar on 14 Feb 2004 (try to change this to file obj)
	private ArrayList childBoard = null;

    //added by saravnan
    private ArrayList bomRevFileList = new ArrayList();
    private String  bomRevFileDetails;
    private ArrayList schematicFileList = new ArrayList();
    private String  schematicFileDetails;
    private ArrayList  schematicFileDetailsList = new ArrayList();
    private ArrayList  bomRevFileDetailsList = new ArrayList();



    //chakravarthy
    //the bom document id
    private int iBomDocId;
    //the  bom document number
	private String sBomDocNumber = null;
    //the schematic docment id
    private int iSchematicDocId = 0;
    //the schematic document number
    private String sSchematicDocNumber = null;
    //the bom file names
	private ArrayList aBomFileNames = null;
    //the scheatic file names
    private ArrayList aSchematicFileNames = null;
    //the bom file location
    private String sBomFileLocation = null;
    //the schematic file location
    private String sSchematicFileLocation = null;
    //boolean  to delete the bom file
    private boolean isBomFileDelete = false;
    //boolean  to delete the schematic file
    private boolean isSchematicDelete = false;

	//the array of bom file files
	private FormFile[] bomDocNames = null;
	//the array of schematic file files
	private FormFile[] schemDocNames = null;

    private String processType = null;

    /* get and set methods */
    
    public int getProductId()
    {
        return productId;
    }
    public void setProductId(int productId)
    {
        this.productId = productId;
    }
    
    public int getProcessStepId()
    {
        return processStepId;
    }
    public void setProcessStepId(int processStepId)
    {
        this.processStepId = processStepId;
    }
    
    public String getPartNumber()
    {
        return partNumber;
    }
    public void setPartNumber(String partNumber)
    {
        this.partNumber = partNumber;
    }
    
    public String getDescription()
    {
        return description;
    }
    public void setDescription(String description)
    {
        this.description = description;
    }
    
    public String getUnitPrice()
    {
        return unitPrice;
    }
    public void setUnitPrice(String unitPrice)
    {
        this.unitPrice = unitPrice;
    }
    
    public ArrayList getVendorLocations()
    {
        return vendorLocations;
    }
    public void setVendorLocations(ArrayList vendorLocations)
    {
        this.vendorLocations = vendorLocations;
    }
    
    // added for Brecis - Balaram on Mar 20, 2003
    public String getProductType() 
    {
        return this.productType;
    }

    public void setProductType (String productType) 
    {
        this.productType = productType;
    }
    
    public boolean getIsApproved ()
    {
        return isApproved;
    }
    
    public void setIsApproved ( boolean isApproved )
    {
        this.isApproved = isApproved;
    }

	//get set methods added for 6 diff types of props for Cavium. Bhaskar on 14 Feb 2004

	public String getPcbRevNo()
	{
		return pcbRevNo;
	}
	
	public void setPcbRevNo( String pcbRevNo )
	{
		this.pcbRevNo = pcbRevNo;
	}
	
	public String getBomRevId ()
	{
		return bomRevId;
	}
	
	public void setBomRevId ( String bomRevId )
	{
		this.bomRevId = bomRevId;
	}
	
	public String getSchematicId ()
	{
		return schematicId;
	}
	
	public void setSchematicId ( String schematicId )
	{
		this.schematicId = schematicId;
	}
	
	public String getBomRevNumber()
	{
		return bomRevNumber;
	}
	
	public void setBomRevNumber( String bomRevNumber )
	{
		this.bomRevNumber = bomRevNumber;
	}
	
	public String getSchematicNumber()
	{
		return schematicNumber;
	}
	
	public void setSchematicNumber( String schematicNumber )
	{
		this.schematicNumber = schematicNumber;
	}
	
	public FormFile getBomRevNo()
	{
		return this.bomRevNo;
	}
	
	public void setBomRevNo( FormFile bomRevNo )
	{
		this.bomRevNo = bomRevNo;
	}
	
	public FormFile getSchematic()
	{
		return schematic;
	}
	
	public void setSchematic( FormFile schematic )
	{
		this.schematic = schematic;
	}

    public ArrayList getChildBoard()
    {
        return childBoard;
    }

    public void setChildBoard( ArrayList childBoard )
    {
        this.childBoard = childBoard;
    }

//------------------------------------
    //chakravarthy
    /**
     * get bom doc id
     * return  iBomDocId
     */
	public int getBomDocId()
	{
		return this.iBomDocId;
	}
    /**
     *set the BomDocId
     *
     *@param iBomDocId
     */
	public void setBomDocId( int iBomDocId)
	{
		this.iBomDocId = iBomDocId;
	}

    /**
     * get bom doc number
     * return  sBomDocNumber
     */
	public String getBomDocNumber()
	{
		return this.sBomDocNumber;
	}

    /**
     *set the BomDocNumber
     *
     *@param sBomDocNumber
     */
	public void setBomDocNumber( String sBomDocNumber)
	{
		this.sBomDocNumber = sBomDocNumber;
	}
    /**
     * get schematic doc id
     * return  iSchematicDocId
     */
    public int getSchematicDocId()
    {
        return this.iSchematicDocId;
    }
    /**
     *set the SchematicDocId
     *
     *@param iSchematicDocId
     */
    public void setSchematicDocId( int iSchematicDocId)
    {
        this.iSchematicDocId = iSchematicDocId;
    }
    /**
     * get schematic doc number
     * return  sSchematicDocNumber
     */
    public String getSchematicDocNumber()
    {
        return this.sSchematicDocNumber;
    }
    /**
     *set the SchematicDocNumber
     *
     *@param sSchematicDocNumber
     */
    public void setSchematicDocNumber( String sSchematicDocNumber)
    {
        this.sSchematicDocNumber = sSchematicDocNumber;
    }
    /**
     * get Bom File Names
     * return  aBomFileNames
     */
	public ArrayList getBomFileNames()
	{
		return this.aBomFileNames;
	}
    /**
     *set the BomFileNames
     *
     *@param aBomFileNames
     */
	public void setBomFileNames( ArrayList aBomFileNames)
	{
		this.aBomFileNames = aBomFileNames;
	}
    /**
     * get schematic Doc Names File Names
     * return  aSchematicFileNames
     */ 
    public ArrayList getSchematicFileNames()
    {
        return this.aSchematicFileNames;
    }
    /**
     *set the schematicFileNames
     *
     *@param aSchematicFileNames
     */
    public void setSchematicFileNames( ArrayList aSchematicFileNames )
    {
        this.aSchematicFileNames = aSchematicFileNames;
    }

	/**
	 * get boolean for bom file delete
	 * return  isBomFileDelete
	 */
	public boolean getIsBomFileDelete()
	{
		return this.isBomFileDelete;
	}

	/**
	 *set the boolean for bom file
	 *
	 *@param isBomFileDelete
	 */
	public void setIsBomFileDelete( boolean isBomFileDelete)
	{
		this.isBomFileDelete = isBomFileDelete;
	}

    /**
     * get boolean for schematic file delete
     * return  isSchematicDelete
     */
    public boolean getIsSchematicDelete()
    {
        return this.isSchematicDelete;
    }

    /**
     *set the boolean  for schematic file delete
     *
     *@param isSchematicDelete
     */
    public void setIsSchematicDelete( boolean isSchematicDelete)
    {
        this.isSchematicDelete = isSchematicDelete;
    }

	/**
	 * get Filefile array of bom files
	 * return  bomDocNames
	 */
	public FormFile[] getBomDocNames()
	{
		return this.bomDocNames;
	}
	
	/**
	 *set the bomDocNames
	 *
	 *@param bomDocNames
	 */
	public void setBomDocNames( FormFile[] bomDocNames)
	{
		this.bomDocNames = bomDocNames;
	}
	
	/**
	 * get Schematic Doc Names
	 * return  schemDocNames
	 */
	public FormFile[] getSchemDocNames()
	{
		return this.schemDocNames;
	}
	/**
	 *set the Schematic Doc Names
	 *
	 *@param schemDocNames
	 */
	public void setSchemDocNames( FormFile[] schemDocNames )
	{
		this.schemDocNames = schemDocNames;
	}

    /**
     * get File Location
     * return  sBomFileLocation
     */
    public String getFileLocation()
    {
        return this.sBomFileLocation;
    }
    /**
     *set the FileLocation
     *
     *@param sBomFileLocation
     */
    public void setFileLocation( String sBomFileLocation)
    {
        this.sBomFileLocation = sBomFileLocation;
    }

    // added by saravnan
	public void setBomRevFileList( ArrayList bomRevFileList )
	{
		this.bomRevFileList = bomRevFileList;
	}

    public ArrayList getBomRevFileList()
    {
        return this.bomRevFileList;
    }

    public void setBomRevFileDetails( String bomRevFileDetails )
	{
		this.bomRevFileDetails = bomRevFileDetails;
	}

    public String getBomRevFileDetails()
    {
        return this.bomRevFileDetails;
    }


    public void setSchematicFileList( ArrayList schematicFileList )
	{
		this.schematicFileList = schematicFileList;
	}

    public ArrayList getSchematicFileList()
    {
        return this.schematicFileList;
    }

    public void setSchematicFileDetails( String schematicFileDetails )
	{
		this.schematicFileDetails = schematicFileDetails;
	}

    public String getSchematicFileDetails()
    {
        return this.schematicFileDetails;
    }


    public void setBomRevFiles( BomRevOrSchmFileList bomRevOrSchmFileList )
	{
		this.bomRevFiles = bomRevOrSchmFileList;
	}

    public BomRevOrSchmFileList getBomRevFiles()
    {
        return this.bomRevFiles;
    }

    public void setSchmaFiles( BomRevOrSchmFileList bomRevOrSchmFileList )
	{
		this.schmaFiles = bomRevOrSchmFileList;
	}

    public BomRevOrSchmFileList getSchmaFiles()
    {
        return this.schmaFiles;
    }

    public void setSchematicFileDetailsList( ArrayList schematicFileDetailsList )
	{
		this.schematicFileDetailsList = schematicFileDetailsList;
	}

    public ArrayList getSchematicFileDetailsList()
    {
        return this.schematicFileDetailsList;
    }

    public void setBomRevFileDetailsList( ArrayList bomRevFileDetailsList )
	{
		this.bomRevFileDetailsList = bomRevFileDetailsList;
	}

    public ArrayList getBomRevFileDetailsList()
    {
        return this.bomRevFileDetailsList;
    }

    // added by saravnan
    public void reset( ActionMapping mapping , HttpServletRequest request )
    {
         isApproved = false;
         ArrayList bomFileList =  bomRevFiles.getFileList();
         for( int i=0 ; i < bomFileList.size() ; i++ )
         {
              ( ( BomRevOrSchmFileDetails )bomFileList.get(i) ).setIsFileDelete( false );
         }

         ArrayList schmaFileList =  schmaFiles.getFileList();
         for( int i=0 ; i < schmaFileList.size() ; i++ )
         {
              ( ( BomRevOrSchmFileDetails )schmaFileList.get(i) ).setIsFileDelete( false );
         }

    }

    public String getProcessType() {
        return processType;
    }

    public void setProcessType(String processType) {
        this.processType = processType;
    }

    /**
     *
     * @return  ArrayList
     */
    public ArrayList getboardProcessList()
    {
        ArrayList boardProcessList = new ArrayList();
        boardProcessList.add(new org.apache.struts.util.LabelValueBean("DIE BANK", "DIE BANK"));
        boardProcessList.add(new org.apache.struts.util.LabelValueBean("ASSEMBLY", "ASSEMBLY"));
        boardProcessList.add(new org.apache.struts.util.LabelValueBean("TEST", "TEST"));
        boardProcessList.add(new org.apache.struts.util.LabelValueBean("FINISHED GOODS", "FINISHED GOODS"));
        return boardProcessList;
    }


}
